package cz.vutbr.fit.xzemko01.tfmcbs.diagram.extensions.validators;

import cz.vutbr.fit.xzemko01.tfmcbs.model.Container;
import cz.vutbr.fit.xzemko01.tfmcbs.model.Delegate;
import cz.vutbr.fit.xzemko01.tfmcbs.model.Interface;
import cz.vutbr.fit.xzemko01.tfmcbs.model.Port;

public class DelegateLinkTargetEndValidator {
	public static boolean validate(Container container, Delegate delegate, Port port, Interface _interface) {
		if(port == null || _interface == null) {
			return false;
		}
		
		return validatePortAndInterfaceAreInSameContainer(port, _interface);
	}
	
	private static boolean validatePortAndInterfaceAreInSameContainer(Port port, Interface _interface) {
		return port.getComponent() == _interface.getContainer();
	}
}